﻿<UserControl x:Class="ScrumFactory.Proposals.HourCostsDialog"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:props="clr-namespace:ScrumFactory.Proposals.Properties"             
             mc:Ignorable="d" 
             MinWidth="300" MinHeight="100"
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="auto"/>
        </Grid.RowDefinitions>

        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" MinHeight="80" Margin="10,10,10,10">
            <Image Source="/Images/information.png"  Width="16" Height="16" Margin="0,0,10,0" VerticalAlignment="Top"/>
            <TextBlock Text="{x:Static props:Resources.No_proposals_tooltip}" Foreground="Black"  Width="200" TextWrapping="Wrap"/>
            <StackPanel.Style>
                <Style>
                    <Setter Property="StackPanel.Visibility" Value="Collapsed"/>
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding HourCosts.Count}" Value="0">
                            <Setter Property="StackPanel.Visibility" Value="Visible"/>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </StackPanel.Style>
        </StackPanel>

        <ItemsControl ItemsSource="{Binding HourCosts}" Padding="10" Grid.Row="0">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding Role.RoleName}" Width="200" TextWrapping="Wrap" VerticalAlignment="Center" Style="{StaticResource LabelTextBlock}"/>
                        <StackPanel Orientation="Vertical">
                            <TextBox Text="{Binding Price, StringFormat='{}{0:C}'}" Width="100" TextAlignment="Right"/>
                            <TextBlock FontSize="{StaticResource SmallFontSize}" Text="{x:Static props:Resources.Price}" HorizontalAlignment="Right"/>
                        </StackPanel>
                        <StackPanel Orientation="Vertical">
                            <TextBox Text="{Binding Cost, StringFormat='{}{0:C}'}" Width="100" TextAlignment="Right"/>
                            <TextBlock FontSize="{StaticResource SmallFontSize}" Text="{x:Static props:Resources.Cost}" HorizontalAlignment="Right"/>
                        </StackPanel>
                    </StackPanel>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
        <Border
                Grid.Row="1"
                HorizontalAlignment="Stretch" 
                Background="{StaticResource WindowButtonBar}"
                >
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                <Button
                    MinWidth="80" Margin="5" HorizontalAlignment="Center"
                    Command="{Binding ChangeCostsCommand}"
                    Content="{x:Static props:Resources.Change}"/>
                <Button
                    MinWidth="80" Margin="5" HorizontalAlignment="Center"
                    Command="{Binding CancelCommand}"
                    Content="{x:Static props:Resources.Cancel}"/>
            </StackPanel>

            
        </Border>
    </Grid>
</UserControl>
